/**
 * 
 */
package photosalvage.config;

import javax.servlet.ServletContext;

import photosalvage.entity.EntityModule;
import photosalvage.rs.RestModule;
import photosalvage.util.SetCharacterEncodingFilter;

import com.google.common.collect.ImmutableMap;
import com.google.inject.servlet.ServletModule;

/**
 * @author shumpei
 * 
 */
public class PhotoSalvageModule extends ServletModule {

	@SuppressWarnings("unused")
	private final ServletContext servletContext;

	public PhotoSalvageModule(ServletContext servletContext) {
		this.servletContext = servletContext;
	}

	@Override
	protected void configureServlets() {
		install(new RestModule());
		install(new EntityModule());

		// Set charactor encoding filter
		filter("/*").through(
				SetCharacterEncodingFilter.class,
				new ImmutableMap.Builder<String, String>().put("encoding",
						"UTF-8").build());
	}
}
